package LoginPackage;


import static org.openqa.selenium.support.ui.ExpectedConditions.visibilityOfElementLocated;
import static org.testng.AssertJUnit.assertEquals;

import java.util.concurrent.TimeUnit;

import org.openqa.selenium.By;
import org.testng.annotations.*;

import PagePackage.MyPageFactory;
import PagePackage.internalPageClass;
import PagePackage.loginPageClass;
import PagePackage.schoolsPage;
import PagePackage.newSchoolPage;

public class EditSchoolClass extends TestBaseClass {
	@Test (priority=0)
	 
	  public void AdminEditSchool() {
		  goToMainPage(); 
		 
		  MyPageFactory.getPage(driver, loginPageClass.class).loginAs("victoria@krossover.com", "webmaster");
		  MyPageFactory.getPage(driver, internalPageClass.class).clickschooltab()
		  .findSchool("Other School Edit")
		  .scrollAndClickSchool(0 , 0,"//*[text()='Other School Edit']")
		  .chooseType("Other")
		  .schoolName("Selenium University Edit")
			.mascot("Selenium University Mascot Edit")
			.conference("Selenium University Conference Edit")
			.division("Selenium University Division Edit")
			.address1("125 Forest Ave Edit")
			.address2("App.4 Edit")
			.city("New York")
			.country("US")
			.state("NY")
			.postal("00124")
			.saveSchool()
		    .findSchool("Selenium University Edit")
		    .scrollAndClickSchool( 0, 0, "//*[text()='Selenium University Edit']");
	
		 //assertEquals("TEAMS", internalPage.teamstab.getText()); 
		  /*wait.until(visibilityOfElementLocated(By.name("name")));
		  assertEquals("Selenium University Edit", newSchoolPage.newSchoolNameField.getText());
		  MyPageFactory.getPage(driver, newSchoolPage.class).checkSchool();
		  
	
		  //assertEquals("Selenium University Edit", newSchoolPage.newSchoolNameField.getText());
		  assertEquals("Selenium University Mascot Edit", newSchoolPage.schoolMascotField.getText());
		  assertEquals("Selenium University Conference Edit", newSchoolPage.conferenceField.getText());
		  assertEquals("Selenium University Division Edit", newSchoolPage.divisionField.getText());
		  assertEquals("125 Forest Ave Edit", newSchoolPage.address1Field.getText());
		  assertEquals("App.4 Edit", newSchoolPage.address2Field.getText());
		  assertEquals("New York", newSchoolPage.cityField.getText());
		  assertEquals("US", newSchoolPage.countryField.getText());
		  assertEquals("NY", newSchoolPage.stateField.getText());
		  assertEquals("00124", newSchoolPage.postalField.getText());*/
		  
		  
		  MyPageFactory.getPage(driver, newSchoolPage.class).chooseType("High School")
		  .schoolName("Other School Edit")
			.mascot("Selenium University Mascot")
			.conference("Selenium University Conference ")
			.division("Selenium University Division")
			.address1("125 Forest Ave")
			.address2("App.4")
			.city("Brooklyn")
			.country("US")
			.state("NY")
			.postal("10022")
			.saveSchool()
		    .findSchool("Other School Edit")
		    .scrollAndClickSchool(0 , 0,"//*[text()='Other School Edit']");
		 /* wait.until(visibilityOfElementLocated(By.name("name")));
		  assertEquals("Other School Edit", newSchoolPage.newSchoolNameField.getText());
		  MyPageFactory.getPage(driver, newSchoolPage.class).checkSchool();
		  assertEquals("Other School Edit", newSchoolPage.newSchoolNameField.getText());
		  assertEquals("Selenium University Mascot", newSchoolPage.schoolMascotField.getText());
		  assertEquals("Selenium University Conference", newSchoolPage.conferenceField.getText());
		  assertEquals("Selenium University Division", newSchoolPage.divisionField.getText());
		  assertEquals("125 Forest Ave", newSchoolPage.address1Field.getText());
		  assertEquals("App.4", newSchoolPage.address2Field.getText());
		  assertEquals("Brooklyn", newSchoolPage.cityField.getText());
		  assertEquals("US", newSchoolPage.countryField.getText());
		  assertEquals("NY", newSchoolPage.stateField.getText());
		  assertEquals("10022", newSchoolPage.postalField.getText());*/
		  driver.get("https://www-dev.krossover.com/intelligence-qa/schools");
			 MyPageFactory.getPage(driver, internalPageClass.class).logout();
			
		  }

}
